<style lang="less">
  .partner-profit-summary-detail{
    .summary{
      border: 1px solid #dfe6ec;
      padding: 20px;
      background-color: moccasin;
      font-size: 20px;
      margin: 0px 0px 5px 0px;
    }
    .title {
      font-size: 35px;
      text-align: center;
      margin-bottom: 5px;
    }
  }
</style>

<template>
  <div class="partner-profit-summary-detail">
    <div class="summary">
      <div class="title">{{title}}</div>
      <div class="columns">
        <div class="column is-2" style="width: 50px;">
          <el-button type="text" icon="el-icon-arrow-left" @click="back">返回</el-button>
        </div>
        <div class="column">
          <div>
            合伙人名称：{{summary.partnerRealName}}
          </div>
          <div>
            收益总额：{{summary.totalAmount}}
          </div>
        </div>
        <div class="column">
          <div>
            合伙人性质：{{summary.partnerTypeName}}
          </div>
          <div>
            已提取金额：{{summary.chargeOffsTotalAmount || 0}}
          </div>
        </div>
        <div class="column">
          <div>
            归属区域：{{summary.partnerAscription}}
          </div>
          <div>
            未提取金额：{{summary.totalAmount - summary.chargeOffsTotalAmount}}
          </div>
        </div>
        <div class="column">
          对应组织：{{summary.partnerOrganizationName}}
        </div>
      </div>

    </div>
    <order-profit-statistics v-if="$route.query.activeName === 'first'" :filters="'EQ_partner.id=' + $route.params.partnerId" profit="partnerAmount" exportUrl="/api/v2.0/admin/partner_profit_summarys_detail_export" type="order">
    </order-profit-statistics>
    <order-profit-statistics v-if="$route.query.activeName === 'second'" :filters="'EQ_partner.id=' + $route.params.partnerId" profit="partnerAmount" exportUrl="/api/v3.0/admin/api/truck-load-partner_profit_summarys_detail_export" type="truckLoadOrder">
    </order-profit-statistics>
  </div>
</template>

<script>
import {getAllPartnerProfitSummariesByPartnerId, getAllPartnerProfitSummariesByPartnerIdVo} from '../../../api/partner/PartnerProfitSummary';
import OrderProfitStatistics from '../OrderProfitStatistics.vue';

export default {
  components: {OrderProfitStatistics},
  props: {
  },
  data () {
    return {
      title: '',
      summary: {
        partnerOrganizationName: null,
        organizationName: null,
        partnerAscription: null,
        partnerTypeName: null,
        partnerRealName: null,
        countyName: null,
        totalAmount: 0,
        chargeOffsTotalAmount: 0
      }
    };
  },
  methods: {
    back () {
      this.$router.push('/settlement_platform/partner_profit_summary');
      //        if (this.$route.query.activeName === 'first') {
      //          this.$router.push('/settlement_platform/partner_profit_summary/first');
      //        } else if (this.$route.query.activeName === 'second') {
      //          this.$router.push('/settlement_platform/partner_profit_summary/second');
      //        }
    }
  },
  mounted () {
    this.title = this.$route.query.title;
    if (this.$route.query.activeName === 'first') {
      getAllPartnerProfitSummariesByPartnerId(this.$route.params.partnerId)
        .then(res => {
          if (res.data.successFlg) {
            this.summary = res.data.obj;
          } else {
            this.$message.error(res.data.errorMsg);
          }
        });
    } else if (this.$route.query.activeName === 'second') {
      getAllPartnerProfitSummariesByPartnerIdVo(this.$route.params.partnerId).then((res) => {
        if (res.data) {
          this.summary = res.data;
        }
      });
    }
  }
};
</script>
